package cn.lc.taotao.controller;

import cn.lc.taotao.pojo.EasyUIDataGridResult;
import cn.lc.taotao.pojo.TbItem;
import cn.lc.taotao.pojo.TreeNode;
import cn.lc.taotao.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: luochao
 * Date: 2017/11/21 0021
 * Time: 下午 2:35
 */
@Controller
public class ItemController {

    @Autowired
    private ItemService itemService;
    @RequestMapping("/item/{itemId}")
    @ResponseBody
    public TbItem  getItemById(@PathVariable Long itemId ){
        TbItem item = itemService.getItemById(itemId);
        return item;
    }

    /**
     * 分页查询商品列表
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping("/item/list")
    @ResponseBody
    public EasyUIDataGridResult getItemList(Integer page, Integer rows){
        EasyUIDataGridResult result =itemService.getItemList(page,rows);
        return result;
    }

   /* public List<TreeNode> getItemCatList(long parentId){

    }*/
}
